﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yunwei.Domain.Models.Mapping
{
    public class DinnerTableMap : EntityTypeConfiguration<DinnerTable>
    {
        public DinnerTableMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name) .IsRequired().HasMaxLength(50);

            this.Property(t => t.Type).IsRequired();

            this.Property(t => t.Price).IsRequired().HasPrecision(18, 2);

            this.Property(t => t.Restaurant_Id).IsRequired();

            this.Property(t => t.Status).IsRequired();

            // Table & Column Mappings
            this.ToTable("DinnerTable");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Price).HasColumnName("Price");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Restaurant_Id).HasColumnName("Restaurant_Id");
        }
    }
}
